<!--分类：列出某分类的全部文章-->
<?php if(isset($articlesAll)): ?>
<?php foreach($articlesAll as $article): ?>
<div class="article" id="c<?php echo $article->id; ?>">

	<?php 
	    echo CHtml::link("#{$article->id}", $article->getUrl($classify), array(
		'class'=>'cid',
		'title'=>'Permalink to this article',
	)); ?>
	<div class="author">
	<?php 
		//获取文章的作者名
		$author=Article::model()->getAuthor($article->user_id); 
		//var_dump($author->attributes);
		echo $author->username;
	?> 发表:
	</div>

	<div class="time">
	<?php echo date('F j, Y \a\t h:i a',$article->create_time); ?>
	</div>
	<div class="title">
		标题:<?php echo CHtml::link((CHtml::encode($article->title)),$article->url); ?>
	</div>

</div><!-- article -->
<?php endforeach; ?>
<?php endif; ?>



<!--分类：列出分类的部分文章-->
<?php if(isset($articles)): ?>
<?php foreach($articles as $key=>$article): ?>
<?php if($key>2): //控制分类下的文章显示，表示只能输出三个文章就停止遍历数组 ?>
<?php break; ?>
<?php endif; ?>

<div class="article" id="c<?php echo $article->id; ?>">

	<?php 
	    echo CHtml::link("#{$article->id}", $article->getUrl($classify), array(
		'class'=>'cid',
		'title'=>'Permalink to this article',
	)); 
	?>

	<div class="author">
	<?php 
		//获取文章的作者名
		$author=Article::model()->getAuthor($article->user_id); 
		//var_dump($author->attributes);
		echo $author->username;
	?> 发表:
	</div>

	<div class="time">
	<?php echo date('F j, Y \a\t h:i a',$article->create_time); ?>
	</div>
	<div class="title">
		标题:<?php echo CHtml::link((CHtml::encode($article->title)),$article->url); ?>
	</div>

</div><!-- article -->
<?php endforeach; ?>
<?php endif;?>